import 'code/Core/Vars/initVars';
import { GameEvents as GameEventsEnum } from 'code/Core/System/Configs/EventConfig';
import UIManagerClass from './manager/UIManager';
import EventSystemClass from './Core/System/EventSystem';
import ShieldSystemClass from './Core/System/ShieldSystem';
import DamageSystemClass from './Core/System/DamageSystem';
import RegenSystemClass from './Core/System/RegenSystem';
import LevelUpSystemClass from './Core/System/LevelUpSystem';
import CoolDownSystem from './Core/System/CoolDownSystem';
import StunSystem from './Core/System/StunSystem';
import RecipeSystem from './Core/System/EquipmentRecipe';
import ModSpeedSystem from './Core/System/ModSpeedSystem';
import HatredySystemClass from './Core/System/Hatredysystem';
import AbilityManagerClass from './manager/AbilityManager';
import GameMain from './Scripts';
import TalentManagerClass from './manager/TalentManager';
import GlobalDBClass from 'code/DB';
import TestSys from './Test/TestSys';
import AbilityIncreaseSystem from './Core/System/AbilityIncreaseSystem';
import MonsterAbilityManager from './manager/MonsterAbilityManager';

declare global {
    // systems
    var EventManager: typeof EventSystemClass;
    var ShieldSystem: ShieldSystemClass;
    var HatredySystemInstance: HatredySystemClass;
    var DamageSystemInstance: DamageSystemClass;
    var RegenSystemInstance: RegenSystemClass;
    var LevelUpSystemInstance: LevelUpSystemClass;
    var CooldownSystemInstance: CoolDownSystem;
    var StunSystemIntance: StunSystem;
    var RecipeSystemInstance: RecipeSystem;
    var AbilityIncreaseInstence: AbilityIncreaseSystem;
    var MonterAbilityInstance: MonsterAbilityManager;
    // managers
    var UIManager: UIManagerClass;
    var AbilityManager: AbilityManagerClass;
    var TalentManager: TalentManagerClass;

    // 全局数据管理
    var GlobalDB: GlobalDBClass;

    var GameEvents: typeof GameEventsEnum;
}

export default class Main {
    constructor() {
        // 全局数据配置
        GlobalDB = new GlobalDBClass();
        GameEvents = GameEventsEnum;

        this.initSystems();
        this.initManagers();

        // 游戏逻辑
        new GameMain();

        // 测试用
        new TestSys();
    }
    initSystems() {
        // 所有的系统在在最前面初始化
        new ModSpeedSystem();
        EventManager = EventSystemClass;
        ShieldSystem = new ShieldSystemClass();
        StunSystemIntance = new StunSystem();
        RecipeSystemInstance = new RecipeSystem();
        DamageSystemInstance = new DamageSystemClass();
        RegenSystemInstance = new RegenSystemClass();
        LevelUpSystemInstance = new LevelUpSystemClass();
        CooldownSystemInstance = new CoolDownSystem();
        HatredySystemInstance = new HatredySystemClass();
        AbilityIncreaseInstence = new AbilityIncreaseSystem();
    }
    initManagers() {
        UIManager = new UIManagerClass();
        AbilityManager = new AbilityManagerClass();
        TalentManager = new TalentManagerClass();
        MonterAbilityInstance = new MonsterAbilityManager();
    }
}
